<template>
    <el-drawer v-model="drawer" size="70%" direction="ttb" :with-header="false" style="padding-right: 20px">
        <h4>编辑设备详情 - {{ form.id }}</h4>
        <el-form :model="form" label-width="120px">
            <el-form-item label="设备名称">
                <el-input v-model="form.name" />
            </el-form-item>
            <el-form-item label="设备备注">
                <el-input v-model="form.desc" />
            </el-form-item>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="设备IP">
                        <el-input v-model="form.ip" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="设备操作系统">
                        <el-input v-model="form.goos" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">提交保存</el-button>
            </el-form-item>
        </el-form>
    </el-drawer>
</template>
<script>
export default{
    data(){
        return {
            form:{},
            drawer:false,
        }
    },
    methods:{
        // 打开弹窗
        Open(res = {}){
            this.form = JSON.parse(JSON.stringify(res))
            this.drawer = true
        },
        // 提交事件
        onSubmit(){
            var that = this
            that.$axios.post("api:dervice.info.set",that.form).then(()=>{
                that.$func.notify("编辑成功")
                that.drawer = false
                that.$emit('refresh')
            })
        }
    },
}
</script>